package com.dpad.telematicsclientapp.netlibrary.newapp.entity;


import com.dpad.telematicsclientapp.netlibrary.R;

/**
 * ================================================
 * 作    者：booob
 * 版    本：1.0
 * 创建日期：2018-12-05-0005 14:50
 * 描    述：
 * 修订历史：
 * ================================================
 */
public enum WeatherEnum {


    WEATHER_ENUM_QING("晴", R.mipmap.qing),
    WEATHER_ENUM_DUOYUN("多云", R.mipmap.duoyun),
    WEATHER_ENUM_DAXUE("大雪", R.mipmap.daxue),
    WEATHER_ENUM_DAYU("大雨", R.mipmap.zhongyu),
    WEATHER_ENUM_DYZXY("多云转小雨", R.mipmap.duoyunzhuanxiaoyu),
    WEATHER_ENUM_LZY("雷阵雨", R.mipmap.leizhenyu),
    WEATHER_ENUM_QZDY("晴转多云", R.mipmap.qingzhuanduoyun),
//        WEATHER_ENUM_DYZQ("多云转晴", R.mipmap.weather_duoyunzhuanqing),
    WEATHER_ENUM_XIAOXUE("小雪", R.mipmap.xiaoxue),
    WEATHER_ENUM_YJX("雨夹雪", R.mipmap.yujiaxue),
    WEATHER_ENUM_YZXX("雨转小雪", R.mipmap.yuzhuanxiaoxue),
    WEATHER_ENUM_ZHONGYU("中雨", R.mipmap.zhongyu),
    WEATHER_ENUM_XIAOYU("小雨", R.mipmap.zhongyu),
    WEATHER_ENUM_LZYJF("雷阵雨加风", R.mipmap.leizhenyujiafeng);


    private String weatherName;
    private int weatherImage;


    // 构造方法
    WeatherEnum(String weatherName, int weatherImage) {
        this.weatherName = weatherName;
        this.weatherImage = weatherImage;
    }

    @Override
    public String toString() {
        return this.weatherName + "_" + this.name();
    }

    public String getWeatherName() {
        return weatherName;
    }

    public void setWeatherName(String weatherName) {
        this.weatherName = weatherName;
    }

    public int getWeatherImage() {
        return weatherImage;
    }

    public void setWeatherImage(int weatherImage) {
        this.weatherImage = weatherImage;
    }

    /**
     * 根据title获取去code
     *
     * @param weatherName
     * @return
     */
    public static int getImageResouse(String weatherName) {
        for (WeatherEnum platformFree : WeatherEnum.values()) {
            if (weatherName.equals(platformFree.getWeatherName())) {
                return platformFree.getWeatherImage();
            }
        }
        return R.mipmap.duoyun;
    }


}
